<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        *{
            margin: 0;
            padding: 0;
            list-style: none;
            border: none;
        }
        img{
            vertical-align: top;
        }
        body{
            background-color: #000;
        }
        #slider{
            width: 1200px;
            height: 460px;
            margin: 100px auto;
            position: relative;
        }
        #slider li{
            position: absolute;
            left: 200px;
            top:0px;
        }
        #slider li img{
            width: 100%;
            height: 100%;
        }
        .slider_ctl_prev, .slider_ctl_next{
            width: 76px;
            height: 112px;
            position: absolute;
            top: 50%;
            margin-top: -56px;
            z-index: 99;
        }
        .slider_ctl_prev{
            background: url("images/prev.png") no-repeat;
            left: 0;
        }
        .slider_ctl_next{
            background: url("images/next.png") no-repeat;
            right: 0;
        }
        #slider_ctl{
            opacity: 0;
        }
    </style>
    <script src="js/myFunc.js"></script>
</head>
<body>
<div id="slider">
    <ul id="slider_main">
        <li><img src="images/slidepic1.jpg" alt=""></li>
        <li><img src="images/slidepic2.jpg" alt=""></li>
        <li><img src="images/slidepic3.jpg" alt=""></li>
        <li><img src="images/slidepic4.jpg" alt=""></li>
        <li><img src="images/slidepic5.jpg" alt=""></li>
    </ul>
    <div id="slider_ctl">
        <span class="slider_ctl_prev"></span>
        <span class="slider_ctl_next"></span>
    </div>
</div>
<script>
    window.onload = function () {
        var slider = document.getElementById("slider");
        var slider_ctl = document.getElementById("slider_ctl");
        var slider_main = document.getElementById("slider_main");
        var AllLis = slider_main.children;
        slider.onmouseover = function () {
            buffer(slider_ctl,{"opacity":1});
        };
        slider.onmouseout = function () {
            buffer(slider_ctl,{"opacity":0});
        };
        var json = [
            {   //  1
                width:400,
                top:20,
                left:50,
                opacity:0.2,
                zIndex:2
            },
            {  // 2
                width:600,
                top:70,
                left:0,
                opacity:0.8,
                zIndex:3
            },
            {   // 3
                width:800,
                top:100,
                left:200,
                opacity:1,
                zIndex:4
            },
            {  // 4
                width:600,
                top:70,
                left:600,
                opacity:0.8,
                zIndex:3
            },
            {   //5
                width:400,
                top:20,
                left:750,
                opacity:0.2,
                zIndex:2
            }
        ];
        for(var i=0;i<json.length;i++){
            buffer(AllLis[i],json[i]);
        }
        for(var j = 0;j<slider_ctl.children.length;j++){
            var span = slider_ctl.children[j];
            span.onmousedown = function () {
               /* alert("123")*/
                if(this.className="slider_ctl_prev"){
                    json.push(json.shift());//第一个放最后一个
                }else{
                    json.unshift(json.pop());//最后一个放第一个
                }
                for(var i=0;i<json.length;i++){
                    buffer(AllLis[i],json[i]);
                }
            };
        }
    }
</script>
</body>
</html>